package com.ymatou.iapi.userservice.testcase;

import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.ymatou.iapi.userservice.parameter.UserBillsRequestDtoBean;
import com.ymatou.iapi.userservice.parameter.req.CreateUserReq;
import com.ymatou.iapi.userservice.service.UserBillsRequestDtoCall;
import com.ymt.base.YmatouEasyCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P2;
import com.ymt.utils.tag.P3;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.database.model.Userinfo;
import com.ymttest.database.mongo.LoginIdUpdateEventHistoryMongoWapper;
import com.ymttest.database.mongo.ULC201406Bean;
import com.ymttest.database.mongo.ULC201406Wapper;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.database.sqlwapper.YmtUsersWapper;
import com.ymttest.utils.DesUtil;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.constant.ECode;

/**
*用户凭据更新请求接口
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_UserBillsRequestDto{
	private static UserBillsRequestDtoBean userbillsrequestdtoBean;
	private static UserBillsRequestDtoCall userbillsrequestdtoCall;
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("用户凭据更新请求接口");
	}

	@Before
	public void caseUp() throws Exception {
		userbillsrequestdtoBean=new UserBillsRequestDtoBean();
		userbillsrequestdtoCall=new UserBillsRequestDtoCall();
	}

	@AfterClass
	public static void tearDown() throws Throwable {
		Logger.generateResult(userbillsrequestdtoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_UserBillsRequestDto_001() {
		Logger.start(true,"更新用户凭证成功(手机，邮箱，用户登陆Id)");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoBean.setUserId(uid);
			userbillsrequestdtoBean.setMail(TestDataManager.getEmail());
			userbillsrequestdtoBean.setLoginId(cur.getLoginId()+1);
			userbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			userbillsrequestdtoBean.setLocked(false);
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(userbillsrequestdtoBean.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(userbillsrequestdtoBean.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(userbillsrequestdtoBean.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(0, ui.getUserState(), "验证锁定状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UserBillsRequestDto_002() {
		Logger.start(false,"不输入任何值，失败");
		try {
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();			
			Logger.verifyEquals(false, userbillsrequestdtoCall.getSuccess(), "验证请求是否成功");
			Logger.verifyEquals("100", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("用户ID未提供", userbillsrequestdtoCall.getMsg(), "验证Msg信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UserBillsRequestDto_003() {
		Logger.start(true,"输入新的用户密码，成功");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoBean.setUserId(uid);
			userbillsrequestdtoBean.setLoginPassword("_NULLYMATOU_");
			userbillsrequestdtoBean.setOldLoginPassword(JUserCallService.defaultLoginPwd);
			userbillsrequestdtoBean.setMail(TestDataManager.getEmail());
			userbillsrequestdtoBean.setLoginId(cur.getLoginId()+1);
			userbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			userbillsrequestdtoBean.setTradingPassword("123abc");
			userbillsrequestdtoBean.setOldTradingPassword("abc123");
			userbillsrequestdtoBean.setLocked(false);
			userbillsrequestdtoBean.setActionSource("MainSite");
			userbillsrequestdtoBean.setClientType("VIP");
			userbillsrequestdtoBean.setClientIp("120.32.4.1");
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();	
			
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(userbillsrequestdtoBean.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(userbillsrequestdtoBean.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(userbillsrequestdtoBean.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(0, ui.getUserState(), "验证锁定状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UserBillsRequestDto_004() {
		Logger.start(true,"输入空的新的交易密码，则交易密码不会被修改");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoBean.setUserId(uid);
			userbillsrequestdtoBean.setLoginPassword(JUserCallService.defaultLoginPwd);
			userbillsrequestdtoBean.setOldLoginPassword(JUserCallService.defaultLoginPwd);
			userbillsrequestdtoBean.setMail(TestDataManager.getEmail());
			userbillsrequestdtoBean.setLoginId(cur.getLoginId()+1);
			userbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			userbillsrequestdtoBean.setTradingPassword("");
			userbillsrequestdtoBean.setOldTradingPassword("abc123");
			userbillsrequestdtoBean.setLocked(true);
			userbillsrequestdtoBean.setActionSource("MainSite");
			userbillsrequestdtoBean.setClientType("VIP");
			userbillsrequestdtoBean.setClientIp("120.32.4.1");
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();	
			
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(userbillsrequestdtoBean.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(userbillsrequestdtoBean.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(userbillsrequestdtoBean.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(1, ui.getUserState(), "验证锁定状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UserBillsRequestDto_005() {
		Logger.start(true,"输入默认的新的交易密码，失败");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoBean.setUserId(uid);
			userbillsrequestdtoBean.setLoginPassword(JUserCallService.defaultLoginPwd);
			userbillsrequestdtoBean.setOldLoginPassword(JUserCallService.defaultLoginPwd);
			userbillsrequestdtoBean.setMail(TestDataManager.getEmail());
			userbillsrequestdtoBean.setLoginId(cur.getLoginId()+1);
			userbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			userbillsrequestdtoBean.setTradingPassword("_NULLYMATOU_");
			userbillsrequestdtoBean.setOldTradingPassword("abc123");
			userbillsrequestdtoBean.setLocked(false);
			userbillsrequestdtoBean.setActionSource("MainSite");
			userbillsrequestdtoBean.setClientType("VIP");
			userbillsrequestdtoBean.setClientIp("120.32.4.1");
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();	
			
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(userbillsrequestdtoBean.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(userbillsrequestdtoBean.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(userbillsrequestdtoBean.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(0, ui.getUserState(), "验证锁定状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserBillsRequestDto_006() {
		Logger.start(true,"如果用户是App注册用户，验证用户认证信息同步更新");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoBean.setUserId(uid);
			userbillsrequestdtoBean.setLoginPassword(JUserCallService.defaultLoginPwd);
			userbillsrequestdtoBean.setOldLoginPassword(JUserCallService.defaultLoginPwd);
			userbillsrequestdtoBean.setMail(TestDataManager.getEmail());
			userbillsrequestdtoBean.setLoginId(cur.getLoginId()+1);
			userbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			userbillsrequestdtoBean.setTradingPassword("abc123");
			userbillsrequestdtoBean.setOldTradingPassword("abc123");
			userbillsrequestdtoBean.setLocked(false);
			userbillsrequestdtoBean.setActionSource("App");
			userbillsrequestdtoBean.setClientType("VIP");
			userbillsrequestdtoBean.setClientIp("120.32.4.1");
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();			
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(userbillsrequestdtoBean.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(userbillsrequestdtoBean.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(userbillsrequestdtoBean.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(0, ui.getUserState(), "验证锁定状态");
			//TODO java版不操作mongo
//			LoginIdUpdateEventHistoryMongoWapper wapper = new LoginIdUpdateEventHistoryMongoWapper();
//			Map<String, Object> result = wapper.getModifyLoginIdInfo(userbillsrequestdtoBean.getLoginId(), 1);
//			Logger.verifyNotNull(result, "App用户认证信息同步");
//			Logger.verifyEquals(userbillsrequestdtoBean.getLoginId(), result.get("nId"), "验证登陆ID已同步");
//			Logger.verifyEquals(uid, result.get("uId"), "验证用户ID已同步");
//			Logger.verifyEquals(userbillsrequestdtoBean.getMobile(), result.get("mobile"), "验证手机已同步");
//			Logger.verifyEquals(1, result.get("uSource"), "验证用户注册入口已同步");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UserBillsRequestDto_007() {
		Logger.start(true,"输入已存在的手机号，邮箱，登陆Id，则手机号，邮箱，登陆Id不会被修改");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			
			CreateUserReq cur2=new CreateUserReq();
			cur2=JUserCallService.initCreateUserBean(cur2);
			int uid2 = JUserCallService.createUserCall(cur2);
			
			
			userbillsrequestdtoBean.setUserId(uid2);
			userbillsrequestdtoBean.setMail(cur.getMail());
			userbillsrequestdtoBean.setLoginId(cur.getLoginId());
			userbillsrequestdtoBean.setMobile(cur.getMobile());
			userbillsrequestdtoBean.setLocked(false);
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();	
			
			Logger.verifyEquals("false", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("198", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("已存在相同手机号码", userbillsrequestdtoCall.getString("LastErrorMessage"), "验证LastErrorMessage");
			//验证LastErrorMessage	已存在相同手机号码(RequestId:5ee36da3df36000eb7568596)


		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UserBillsRequestDto_008() {
		Logger.start(false,"输入不存在的用户ID，失败");
		try {
			userbillsrequestdtoBean.setUserId(-48484);
			userbillsrequestdtoBean.setLoginPassword(JUserCallService.defaultLoginPwd);
			userbillsrequestdtoBean.setOldLoginPassword(JUserCallService.defaultLoginPwd);
			userbillsrequestdtoBean.setMail("kitty270@sohu.com");
			userbillsrequestdtoBean.setLoginId("kexin");
			userbillsrequestdtoBean.setMobile("13654197476");
			userbillsrequestdtoBean.setTradingPassword("abc123");
			userbillsrequestdtoBean.setOldTradingPassword("abc123");
			userbillsrequestdtoBean.setLocked(false);
			userbillsrequestdtoBean.setActionSource("MainSite");
			userbillsrequestdtoBean.setClientType("VIP");
			userbillsrequestdtoBean.setClientIp("120.32.4.1");
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();	
			
			Logger.verifyEquals(false, userbillsrequestdtoCall.getSuccess(), "验证请求是否成功");
			Logger.verifyEquals("100", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("用户ID未提供", userbillsrequestdtoCall.getString("LastErrorMessage"), "验证LastErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserBillsRequestDto_009() {
		Logger.start(true,"更新用户凭证用户登陆Id,id长度超过40成功(锁定)");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoBean.setUserId(uid);
			userbillsrequestdtoBean.setLoginPassword(JUserCallService.defaultLoginPwd);
			userbillsrequestdtoBean.setOldLoginPassword(JUserCallService.defaultLoginPwd);
			userbillsrequestdtoBean.setMail(TestDataManager.getEmail());
			userbillsrequestdtoBean.setLoginId(cur.getLoginId()+TestDataManager.getRandomNumToHex(40));
			userbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			userbillsrequestdtoBean.setOldTradingPassword("abc123");
			userbillsrequestdtoBean.setLocked(true);
			userbillsrequestdtoBean.setActionSource("MainSite");
			userbillsrequestdtoBean.setClientType("VIP");
			userbillsrequestdtoBean.setClientIp("120.32.4.1");
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();	
			
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(userbillsrequestdtoBean.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(userbillsrequestdtoBean.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(userbillsrequestdtoBean.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(1, ui.getUserState(), "验证锁定状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserBillsRequestDto_010() {
		Logger.start(true,"查询用户信息JIRACONN-3265");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoCall=new UserBillsRequestDtoCall("GET", "PARAM");
			userbillsrequestdtoBean.setUserId(uid);
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(cur.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(cur.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(cur.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(0, ui.getUserState(), "验证锁定状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserBillsRequestDto_011() {
		Logger.start(true,"查询用户信息loginid");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoCall=new UserBillsRequestDtoCall("GET", "PARAM");
			userbillsrequestdtoBean.setLoginId(cur.getLoginId());
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(cur.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(cur.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(cur.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(0, ui.getUserState(), "验证锁定状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserBillsRequestDto_012() {
		Logger.start(true,"查询用户信息Mobile");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoCall=new UserBillsRequestDtoCall("GET", "PARAM");
			userbillsrequestdtoBean.setMobile(cur.getMobile());
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(cur.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(cur.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(cur.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(0, ui.getUserState(), "验证锁定状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserBillsRequestDto_013() {
		Logger.start(true,"查询用户信息mail");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoCall=new UserBillsRequestDtoCall("GET", "PARAM");
			userbillsrequestdtoBean.setMail(cur.getMail());
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(cur.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(cur.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(cur.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(0, ui.getUserState(), "验证锁定状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserBillsRequestDto_014() {
		Logger.start(true,"密码查询用户信息");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoCall=new UserBillsRequestDtoCall("GET", "PARAM");
			userbillsrequestdtoBean.setUserId(uid);
			userbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(cur.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(cur.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(cur.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(0, ui.getUserState(), "验证锁定状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserBillsRequestDto_015() {
		Logger.start(false,"错误密码查询用户信息,失败");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoCall=new UserBillsRequestDtoCall("GET", "PARAM");
			userbillsrequestdtoBean.setUserId(uid);
			userbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword()+1);
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();
			Logger.verifyEquals("false", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("100003", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_UserBillsRequestDto_016() {
		Logger.start(true,"锁定后查询用户信息");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			JUserCallService.lockUsers(uid);
			userbillsrequestdtoCall=new UserBillsRequestDtoCall("GET", "PARAM");
			userbillsrequestdtoBean.setUserId(uid);
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(cur.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(cur.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(cur.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(1, ui.getUserState(), "验证锁定状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_UserBillsRequestDto_017() {
		Logger.start(true,"输入新的用户密码，密码加密，成功");
		try {
			CreateUserReq cur=new CreateUserReq();
			cur=JUserCallService.initCreateUserBean(cur);
			int uid = JUserCallService.createUserCall(cur);
			userbillsrequestdtoBean.setPasswordType(1);
			userbillsrequestdtoBean.setUserId(uid);
			
			userbillsrequestdtoBean.setLoginPassword(DesUtil.encrypt("_NULLYMATOU_",DesUtil.DES_KEY_STRING,DesUtil.DES_IVPARAMETER));
			userbillsrequestdtoBean.setOldLoginPassword(DesUtil.encrypt(JUserCallService.defaultLoginPwd,DesUtil.DES_KEY_STRING,DesUtil.DES_IVPARAMETER));
			userbillsrequestdtoBean.setMail(TestDataManager.getEmail());
			userbillsrequestdtoBean.setLoginId(cur.getLoginId()+1);
			userbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			userbillsrequestdtoBean.setTradingPassword(DesUtil.encrypt("123abc",DesUtil.DES_KEY_STRING,DesUtil.DES_IVPARAMETER));
			userbillsrequestdtoBean.setOldTradingPassword(DesUtil.encrypt("abc123",DesUtil.DES_KEY_STRING,DesUtil.DES_IVPARAMETER));
			userbillsrequestdtoBean.setLocked(false);
			userbillsrequestdtoBean.setActionSource("MainSite");
			userbillsrequestdtoBean.setClientType("VIP");
			userbillsrequestdtoBean.setClientIp("120.32.4.1");
			userbillsrequestdtoCall.setData(userbillsrequestdtoBean);
			userbillsrequestdtoCall.callService();	
			
			Logger.verifyEquals("true", userbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", userbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Userinfo ui = new JUserWapper().selectUserinfoByUid(uid).get(0);
			Logger.verifyEquals(userbillsrequestdtoBean.getLoginId(), ui.getLoginId(), "验证登陆ID");
			Logger.verifyEquals(userbillsrequestdtoBean.getMail(), ui.getLoginMail(), "验证邮箱");
			Logger.verifyEquals(userbillsrequestdtoBean.getMobile(), ui.getLoginMobile(), "验证手机");
			Logger.verifyEquals(0, ui.getUserState(), "验证锁定状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}